<?php

class InviaForm extends sfForm
{

  public function configure()
  {
    $this->setWidgets(array(
      'email_destinatario'   => new sfWidgetFormInput(),
      'nome_destinatario'   => new sfWidgetFormInput(),
      'email_tua'   => new sfWidgetFormInput(),
      'nome_tuo'   => new sfWidgetFormInput(),
      'message' => new sfWidgetFormTextarea(),
    ));   

    $this->setValidators(array(
      'email_destinatario'  => new sfValidatorEmail(),
      'nome_destinatario' => new sfValidatorString(array('required' => false)),
      'email_tua'  => new sfValidatorEmail(),
      'nome_tuo' => new sfValidatorString(array('required' => false)),
      'message' => new sfValidatorString(array('required' => true)),
    ));

    $this->widgetSchema['captcha'] = new sfWidgetFormReCaptcha(array(
      'public_key' => '6LcUvb8SAAAAACH7jqkjLEsPUcYPcNXcHfH760KV '
    ));

    $this->validatorSchema['captcha'] = new sfValidatorReCaptcha(array(
      'private_key' => '6LcUvb8SAAAAAKrYpT6ueOaUkILzyyHz2nbQpxWj '
    ));

    $this->widgetSchema->setNameFormat('invia[%s]');
  }
}
